<%@ page import="javabean.CustomerPackage" %>
<%@ page import="javabean.Customer" %>
<%@ page import="javabean.Package" %>
<%@ page import="DAO.PackageDAO" %>
<%@ page import="DAO.DAOFactory" %>
<%--
  Created by IntelliJ IDEA.
  User: FX506L
  Date: 2023-05-13
  Time: 9:16
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%
    CustomerPackage Curpackage = (CustomerPackage) session.getAttribute("curPackage");
    Customer loginCustomer = (Customer) session.getAttribute("loginCustomer");
%>

<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta
            name="viewport"
            content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
    />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>我的套餐</title>
    <link href="css/MyPackage.css" rel="stylesheet">
    <link href="css/Bar.css" rel="stylesheet">
</head>
<body>
<div class="header">
    <h2>移动网上营业厅</h2>
</div>
<div class="content">

    <div class="left">
        <ul>
            <li><a href="Login.jsp">登录</a></li>
            <li><a href="Registration.jsp">注册</a></li>
            <li><a href="index.jsp">首页</a></li>
            <li><a href="Personal_Info.jsp">个人信息</a></li>
            <li><a href="MyPackage">我的套餐</a></li>
            <li><a href="Balance.jsp">查询余额</a></li>
            <li><a href="MyBill.jsp">查询账单</a></li>
            <li><a href="Subpackage">套餐订购</a></li>
            <li><a href="Recharge.jsp">充值缴费</a></li>
            <li><a href="MyOrder.jsp">我的订单</a></li>
            <li><a href="MyComplaint.jsp">我的投诉</a></li>
            <li><a href="MyRepair.jsp">我的报修</a></li>
            <li><a href="Account_cancellation.jsp">账号注销</a></li>
        </ul>
    </div>
    <%
        PackageDAO packageDAO = (PackageDAO) DAOFactory.getPackageDAOInstance();
        Package Package = packageDAO.SearchPackageByID(Curpackage.getPackageID());
        String name = Package.getPackageName() != null ? Package.getPackageName() : "null";
        Double price = Package.getPrice() != 0 ? Package.getPrice() : 0;
        int callTime = Package.getCallTime() != 0 ? Package.getCallTime() : 0;
        String phoneNumber = Curpackage.getPhoneNumber() != null ? Curpackage.getPhoneNumber() : "null";
        String startDate = Curpackage.getStartDate() != null ? String.valueOf(Curpackage.getStartDate()) : "null";
        String endDate = Curpackage.getEndDate() != null ? String.valueOf(Curpackage.getEndDate()) : "null";
        String packageStatus = Curpackage.getPackageStatus() != null ? Curpackage.getPackageStatus() : "null";
    %>
    <div class="right">

        <section>
            <h1>我的套餐</h1>
            <ul>
                <li>套餐名称：<%= name %></li>
                <li>电话号码：<%= phoneNumber %></li>
                <li>价格：<%= price != 0 ? price + " RMB" : "null" %></li>
                <li>呼叫时间：<%= callTime != 0 ? callTime + " 小时" : "null" %></li>
                <li>开始时间：<%= startDate %></li>
                <li>结束时间：<%= endDate %></li>
                <li>套餐状态：<%= packageStatus %></li>
            </ul>
            <form action="Subpackage">
                <input type="submit" value="更换套餐" />
            </form>
            <form action="Package_Delete" onsubmit="return confirm('是否确认删除此套餐？');">
                <input type="submit" value="删除套餐" />
            </form>
        </section>

    </div>

</div>
</body>
</html>
